package script;


import java.util.concurrent.TimeUnit;
import org.openqa.selenium.WebDriver;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
import action.PageActions_Home;
import action.PageActions_Login;
import utility.Contants;
import utility.DriverFactory;
import utility.UITest;

public class loginTest extends UITest {

	WebDriver driver=DriverFactory.getChromeDriver();
	PageActions_Login actionLogin; 
	PageActions_Home actionHome;
	
	@BeforeTest(alwaysRun = true)
    public void BeforeClass() {
		actionLogin = new PageActions_Login(driver);
		actionHome = new PageActions_Home(driver);
		driver.get(Contants.url);
		driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
    }
    
    @Test(groups = {"p0"})
    public void login() throws InterruptedException {
        
    	actionHome.clickUserbar_login();
    	actionLogin.enterName(Contants.userName);
    	actionLogin.enterPassword(Contants.userPassword);
    	actionLogin.clickLogin_Button();
    	actionHome.clickUserbar_logout();
    }
	

    @BeforeClass
    public void beforeClass() {
    }

    @AfterClass
    public void afterClass() {
    }

    @AfterTest
    public void afterTest() {
  	  driver.quit();
    }

}
